<?php
if (!defined('IN_CONTEXT')) die('access violation error!');

class lib_controller
{
	protected $_layout = 'init';
	protected $_view_arr = array();
	
	protected $_mysql_;
	protected $_session_;
	protected $_xml_;
	
	public function __construct()//子类没有显式定义初始化方法则调用父类初始化方法
	{
		$this->_mysql_ = lib_database::init();
		$this->_session_ = lib_session::init();
		$this->_xml_ = lib_xml::init();
	}
	
	//总是第一个被调用的方法,在此判断登录用户角色的每个动作是否被授权，以防登录用户编写脚本伪造执行未授权动作
	public function init($action)
	{
		
	}
	
	public function setLayout($layout)
	{
		$this->_layout = $layout;
	}
	
	public function getLayout()
	{
		return $this->_layout;
	}
	
	public function assign($key,$value)
	{
		$this->_view_arr[$key] = $value;
	}
	
	public function getValues()
	{
		return $this->_view_arr;
	}
}
?>